<?php
//yield

//1.php5.5 迭代函数
//即函数有yield 关键字,主要for循环,
//与range()函数相比,节约内存


$p=range(0, 1000000);


function xrange($start, $end, $step = 1) {
    for ($i = $start; $i < $end; $i += $step) {
        yield $i;
    }
}
foreach (xrange(1, 1000000) as $i) {
 //var_dump($i);
}

//sleep(100)  ;用于测试

class pp{
   public $personName="" ;
   public $age="" ;
   public function __construct($personName,$age) {
    $this->personName=$personName;
    $this->age=$age;
   }
}
$arrobjs=[
     new pp("bb",25),
     new pp("aa",26),
     new pp("cc",27),
     new pp("dd",28),

];



